# 迭代

# from collections.abc import Iterable

# iterObj = {
#     'a': 1,
#     'b': 2
# }

# if isinstance(iterObj, Iterable):
#     for key in iterObj:
#         print(key)

# 使用列表生成式
# rangeList = [i * i for i in range(1, 5) if i % 2 == 0]

# print(rangeList)

# 多层循环

# muitArr = [str(x) + y for x in range(1, 5) for y in 'Bear' ]

# print(muitArr)

# 列出当前目录文件 => List[]
# from os import listdir

# print(listdir('.'))

# files = [item for item in listdir('..')]

# print(files)

# 字典类型
# obj = {
#     'a': 'hello'
# }
# .items => (key, value)
# print([key + value for key, value in obj.items()])

# L = ['Hello', 'World', 'IBM', 'Apple']

# lowerList = [item.lower() for item in L]

# print(lowerList)

# 筛选

L = ['Hello', 'World', 18, 'Apple', None]

lowerList = []

for item in L:
    if isinstance(item, str):
        lowerList.append(item.lower())

print(lowerList)